package com.webwork.project.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webwork.project.system.dao.IQueryUserDao;
import com.webwork.project.system.dataobject.SysUser;
import com.webwork.project.system.dataobject.SysUserQuery;
import com.webwork.project.system.service.IFuncUserSve;

/**
 * 用户功能性服务实现
 *
 */
@Service
public class UserFuncSveImpl implements IFuncUserSve {
	
	@Autowired
	private IQueryUserDao queryUserDao;

	@Override
	public SysUser getUsable(String userAccount) {
		SysUser ret = null;
		
		SysUserQuery queryObj = new SysUserQuery();
		queryObj.setUserAccount(userAccount);
		queryObj.setStatus(1);
		List<SysUser> userList = queryUserDao.query(queryObj, 0, 0);
		if (null != userList && userList.size() > 0) {
			ret = userList.get(0);
			if (userList.size() > 1) {
				System.out.println(userAccount.concat("不唯一"));
			}
		} else {
			System.out.println(userAccount.concat("不存在"));
		}
		return ret;
	}

}
